Method and device for camera rapid automatic focusing

ABSTRACT

The disclosure discloses a method and device for camera rapid automatic focusing. The method comprises: driving a lens to move to multiple different focus positions to acquire image data of a object, and calculating a corresponding estimated focus value in a first high frequency and a corresponding determined focus value in a second high frequency for each image data; calculating a rate of change between a current determined focus value and a previous determined focus value, and determining a direction of movement of the lens on the basis of the rate of change being either positive or negative; comparing the rate of change with a preset focus change threshold, and determining a speed of movement of the lens on the basis of a comparison result; and repeating said steps until the lens moves to a focus position corresponding to a maximum of the estimated focus values.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is national stage application of PCT/CN2016/110127filed Dec. 15, 2016, and is based upon and claims priority to ChinesePatent Application No. 201510982071.0, filed in China on Dec. 23, 2015,the entire contents of which are incorporated herein by reference.

TECHNICAL FIELD

The disclosure relates to the technical field of focusing, andparticularly to a method and device for camera rapid automatic focusing.

BACKGROUND

Due to the wide application of photoelectric image sensors CCDs andCMOSs in the field of image video, digital cameras and video camerashave been made ubiquitous in engineering application and daily life. Themain functions of both the digital cameras and the video cameras areacquiring clear images, i.e. enabling the definition of images to beoptimal by adjusting a position of a camera focus lens group. Thus, afocusing technique already becomes the key of imaging products, inparticular video cameras.

At present, an automatic focus technique based on digital imageprocessing has gradually replaced the traditional automatic focus methodbased on ranging principle. The automatic focus technique based ondigital image processing utilizes a certain digital image processingalgorithm to acquire an evaluated focus value capable of judging thedefinition of an image, which is generally a high-frequency componentvalue of image data, and according to this evaluated value, adoptscertain algorithm and strategy to control a focus motor of a lens tomove to reach a focus position corresponding to the evaluated focusvalue, so as to acquire a clear image.

However, the automatic focus algorithm in the prior art employs a fixedsmall step length when performing a search for the travel of the focusmotor, and thus will cause a wastage of focusing time due to a slowfocus speed and will cause a problem of shaking due to being trapped ata local pole. However, although increasing the step length employed atthe time of searching (reducing sampling points) can increase a speed ofautomatic focusing, sparse sampling near a peak value will make focusingprecision not high. It is difficult for most of the currently employedmethods and devices for automatic focusing to reach balance betweenspeed and precision.

SUMMARY

An object of the disclosure is to provide a method for automatic focuscontrol and a device employing the method in order to solve aforesaid atleast one problem.

To achieve the object, the disclosure adopts the following technicalsolution:

The disclosure provides a method for camera rapid automatic focusing,comprising:

a focus value calculation step of driving a lens to move to multipledifferent focus positions to acquire respective image data of a certainobject, and calculating a corresponding estimated focus value in a firsthigh frequency and a corresponding determined focus value in a secondhigh frequency for each image data, wherein a frequency value in thesecond high frequency is greater than a frequency value in the firsthigh frequency;

a direction determination step of calculating a rate of change between acurrent determined focus value and a previous determined focus value,and determining a direction of movement of the lens in a next movementon the basis of the rate of change being either positive or negative;

a speed determination step of comparing the rate of change with a presetfocus change threshold, and determining a speed of movement of the lensin the next movement on the basis of a comparison result; and

repeatedly performing said focus value calculation step, said directiondetermination step and said speed determination step until the lensmoves to a focus position corresponding to a maximum of the estimatedfocus values.

According to another aspect of the disclosure, the disclosure furtherprovides a device for camera rapid automatic focusing, comprising:

a focus value calculation module for driving a lens to move to multipledifferent focus positions to acquire respective image data of a certainobject, and calculating a corresponding estimated focus value in a firsthigh frequency and a corresponding determined focus value in a secondhigh frequency for each image data, wherein a frequency value in thesecond high frequency is greater than a frequency value in the firsthigh frequency;

a direction determination module for calculating a rate of changebetween a current determined focus value and a previous determined focusvalue, and determining a direction of movement of the lens in a nextmovement on the basis of the rate of change being either positive ornegative;

a speed determination module for comparing the rate of change with apreset focus change threshold, and determining a speed of movement ofthe lens in the next movement on the basis of a comparison result; and

a movement module for repeatedly performing said focus value calculationstep, said direction determination step and said speed determinationstep until the lens moves to a focus position corresponding to a maximumof the estimated focus values.

According to yet another aspect of the disclosure, there is provided acomputer program comprising a computer readable code that, when run on aterminal device, causes the terminal device to implement any aforesaidmethod for camera rapid automatic focusing.

According to still another aspect of the disclosure, there is provided acomputer readable medium storing therein the computer program forimplementing any aforesaid method for camera rapid automatic focusing.

Compared with the prior art, the disclosure has the followingadvantages:

The disclosure provides a method for camera rapid automatic focusing,which: acquires image data of an object at multiple different focuspositions between a lens and the object; and calculates an estimatedfocus value in a first high frequency and a determined focus value in asecond high frequency for each image data; and calculates a rate ofchange between a current determined focus value and a previousdetermined focus value, and determines a direction of movement of thelens in a next movement on the basis of a comparison result of the rateof change with a preset focus change threshold, until the lens moves toa focus position corresponding to a maximum of the estimated focusvalue. That is, the disclosure can change a speed of movement of thelens on the basis of a value of the rate of change, that is, employdifferent speeds of movement at different positions, thus effectivelyreducing focusing time, while taking into consideration focusing speedand precision, and providing high reliability and practicability.

Additional aspects and advantages of the disclosure will be partly givenin the following descriptions, which will become apparent from thefollowing descriptions or be appreciated through the implementation ofthe disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and/or additional aspects and advantages of the disclosurewill become apparent and intelligible from the following descriptions ofembodiments combined with accompanying drawings, wherein:

FIG. 1 is two focus curve diagrams in different frequencies in a methodfor automatic focus control in the disclosure, which show relationsbetween focus positions and estimated focus values;

FIG. 2 is a process flow chart of one embodiment of a method for camerarapid automatic focusing in the disclosure;

FIG. 3 is a structural block diagram of one embodiment of a device forcamera rapid automatic focusing in the disclosure;

FIG. 4 is a block diagram of a terminal device for implementing themethod according to the disclosure in the disclosure; and

FIG. 5 is a storage cell for retaining or carrying a program code forimplementing the method according to the embodiment of the disclosure inthe disclosure.

DETAILED DESCRIPTION

The disclosure will be further described combined with the accompanyingdrawings and illustrative embodiments below. The illustrativeembodiments are shown in the accompanying drawings, throughout whichsame or similar reference numerals denote same or similar elements orelements with same or similar functions. The embodiments described withreference to the accompanying drawings below are illustrative, and areused only for construing the disclosure but shall not be construed aslimitations to the disclosure. In addition, detailed descriptions ofknown techniques will be omitted if they are not necessary forillustrating features of the disclosure.

As could be understood by a person skilled in the art, the singularforms “a”, “one”, “said” and “the” used herein may also include pluralforms, unless otherwise indicated. It should be further understood thatthe word “comprise” used in the description of the disclosure refers toexistence of the features, integers, steps, operations, elements and/orassemblies but does not exclude existence or addition of one or moreother features, integers, steps, operations, elements, assemblies and/orgroups thereof. It should be understood that, when an element isreferred to as being “connected” or “coupled” to another element, theelement may be directly connected or coupled to other elements, or theremay also exist an intermediate element. In addition, the word “connect”or “couple” used herein may include wireless connection or wirelesscoupling. The word “and/or” used herein includes all or any unit and allcombinations of one or more associated listed items.

As could be understood by a person skilled in the art, all the terms(including technical terms and scientific terms) used herein have samemeanings as they are generally understood by a person ordinarily skilledin the field to which the disclosure pertains, unless otherwise defined.It should also be understood that, terms such as those defined in ageneral dictionary should be construed as having meanings consistentwith those in the context of the prior art and, unless specificallydefined as herein, will not be interpreted with ideal or quite formalmeanings.

It should be noticed that the method for rapid automatic focusingaccording to the disclosure is applied to an automatic focus process ofa camera or a video camera at the time of capturing an image. Of course,the method according to the disclosure may also be applied to deviceswith a photographing function, such as a cellphone, a PAD, a PortableMultimedia Player (PMP), a TV or the like.

Specifically, referring to FIG. 2, which is a process flow chart of oneembodiment of the method for camera rapid automatic focusing in thedisclosure, the method comprises the following steps:

S11: a focus value calculation step of driving a lens to move tomultiple different focus positions to acquire respective image data of acertain object, and calculating a corresponding estimated focus value ina first high frequency and a corresponding determined focus value in asecond high frequency for each image data, wherein a frequency value inthe second high frequency is greater than a frequency value in the firsthigh frequency.

It should be noticed that, the disclosure drives a lens to move betweenthe lens and an object through driving means, and presets a first speedvalue at which the lens moves, and stops the lens based on a preset timeinterval, so as to acquire corresponding image data at a current focusposition, and can acquire image data at multiple different focuspositions, and calculate a corresponding estimated focus value in afirst high frequency for the image data and calculate a correspondingdetermined focus value in a second high frequency for the image data.

It should be noticed that the driving means may be a stepping motor,which is driven to rotate under the control of a controller or a driver,so as to drive movement of the lens. It will not be difficult tounderstand that the preset time interval and the first speed value atwhich the lens initially moves may be stored in advance in a storagemedium, wherein the storage medium may be a Synchronous Dynamic RandomAccess Memory (SDRAM), Multi-Chip-Package (MCP) memory or a DynamicRandom Access Memory (DRAM).

It should be noticed that the first speed value at which the lens movesmay also be understood as an initial unit step length, and the steplength refers to a distance of movement of the lens during a period froma current focus position corresponding to the start of movement to thestop of the movement. In an actual operation process, the unit steplength is generally represented by a pulse number of a specific pulsewidth, so its specific numerical value is related to relevant parametersof the used controller, driver and motor, and meanwhile the numericalvalue of the step length also determines the real-time and robustness ofan algorithm to a certain extent, and thus shall be determined throughexperiments according to actual system constitution. The step lengthgenerally produces the following influences upon the entire method: ifthe step length is too small, time consumption of the automatic focusprocess will be serious, and meanwhile it will be made easy to betrapped at the local pole in a focus start phase; however, if the steplength is too large, it will be made easy to override a maximum of theestimated focus values in a search process of the maximum, and if theoverridden distance is too great, the algorithm adopted in the methodwill be disabled to converge.

It will not be difficult to understand that: if it is assumed that themultiple focus positions where the lens is driven to move include atarget focus position, then multiple groups of estimated focus valuesand corresponding focus positions thereof may form the focus curve S1diagram as shown in FIG. 1, and for the same reason, multiple groups ofdetermined focus values and corresponding focus positions thereof mayform the focus curve S2 diagram as shown in FIG. 1. The same focusposition corresponds to one estimated focus value and one determinedfocus value, and both the maximum of the estimated focus values and themaximum of the determined focus values correspond to the same targetfocus position.

Specifically, the present embodiment, by invoking driving means, changesa distance between the lens and the object based on a certain timeinterval and acquires image data of a certain frame of the image atfocus positions corresponding to the distance. Then, de-noising, gammacorrection, color filter array interpolation, color matrix processing,color correction or color enhancement is performed on the image datathrough an image signal processing device to improve image quality, andby performing filtering and de-noising by two high-pass filters orband-pass filters in different frequency bands, high-frequency componentdata of the image data in the two different frequency bands can beobtained. Then based on the acquired data and a preset first calculationrule, a corresponding estimated focus value in the first high frequencyf1 and a corresponding determined focus value in the second frequency f2can be calculated, where f2>f1.

Thus it will not be difficult to understand that, in FIG. 1, since morenoise can be filtered in the second high frequency f2, the focus curvecorresponding to the second high frequency f2 at a position farther fromthe target focus position is gentler than the focus curve correspondingto the first high frequency f1 at the same focus position; however, acurve change rate of the focus curve corresponding to the second highfrequency f2 at a position closer to the target focus position isgreater than a slope of the focus curve corresponding to the first highfrequency f1 at the same focus position. That is, by judging a slopevalue of curve change in the second high frequency f2, it can beobtained more accurately that the current focus position of the lens isreaching the target focus position. Hereinafter, it will be described indetail how to use curve features in the second high frequency f2 toprompt that the lens is reaching the target focus position, so as tochange a speed of movement of the lens.

Specifically, as shown by one embodiment of the disclosure, after theimage data at the multiple focus positions are acquired, correspondingestimated focus value and determined focus value are further calculatedfor each of the multiple focus positions based on a preset firstcalculation rule, wherein the preset first calculation rule is preset tobe stored in a storage medium, wherein the storage medium may be aSynchronous Dynamic Random Access Memory (SDRAM), Multi-Chip-Package(MCP) memory or a Dynamic Random Access Memory (DRAM).

It should be noticed that the estimated focus value and the determinedfocus value described in the disclosure refer to numerical valueestimation indices representing states of a characterizing portion and aprofile portion of a clearly visible image. Thus for the estimated focusvalue, the estimated focus value can be calculated through edgeenhancement of differences in brightness data between adjacent pixels ofthe image, or, the estimated focus value can also be calculatedaccording to a gray value of a pixel, a reciprocal of brightness, adeviation of brightness and the like.

As shown by one embodiment of the disclosure, a corresponding algorithmfor calculating corresponding estimated focus value and determined focusvalue for each of the multiple focus positions in disclosure is:Estimated focus value=Σ_(x=0) ^(n)Σ_(y=0) ^(n) |hpf_o(x,y)|²,

where the x denotes a horizontal high-frequency component value, and they denotes a vertical high-frequency component value. This algorithmobtains the estimated focus value by performing an accumulation on allhorizontal x and vertical y high-frequency energy values of the obtainedcurrent frame of image data of the data image.

Further, referring to FIG. 2, the method in one embodiment of thedisclosure further comprises the following step:

S12: a direction determination step of calculating a rate of changebetween a current determined focus value and a previous determined focusvalue, and determining a direction of movement of the lens in a nextmovement on the basis of the rate of change being either positive ornegative.

It will not be difficult to understand from aforesaid step that, whenthe focus curve corresponding to the second frequency f2 moves from agentle position to the vicinity of the target focus position, the changeof the slope of the curve is greater; that is, it can be judged, fromthe rate of change of the curve, whether an area where the current focusposition lies is close to the target focus position. In one embodimentof the disclosure, the algorithm for calculating the rate of changebetween the acquired current determined focus value and the previousdetermined focus value is:Change rate=(Current determined focus value−Previous determined focusvalue)÷Step length,

wherein the step length is a step length for the lens to move from afocus position corresponding to the previous determined focus value to afocus position corresponding to the current determined focus value.

Further, in one embodiment of the disclosure, the direction of movementof the lens in the next movement is determined on the basis of the rateof change being either positive or negative. When the calculated rate ofchange between the acquired current determined focus value and theprevious determined focus value is positive, it is represented that thecurrent determined focus value is greater than the previous determinedfocus value, that is, the current focus position does not override apeak value of the target focus position, then it can be determined thata current direction of movement of the lens is the direction of movementof the lens in the next movement; and otherwise, when the rate of changeis negative, it is represented that the current determined focus valueis smaller than the previous determined focus value, that is, thecurrent focus position possibly has overridden the peak value of thetarget focus position or has overridden one local pole. Thus in thepresent embodiment, it is also necessary to further judge whether thecurrent focus position is only the local pole which has been overridden.

Specifically, in one embodiment of the disclosure, an estimated focusthreshold is preset; when it is already judged in the directiondetermination step that the acquired rate of change is negative, it isalso necessary to compare the current estimated focus value with thepreset estimated focus threshold; when the estimated focus threshold isgreater than or equal to the estimated focus value, it is representedthat the estimated focus value is not the local pole, which indicatesthat the target focus position has been overridden, then the directionof movement of the lens in the next movement is opposite to the currentdirection of movement; and otherwise, when the current estimated focusvalue is less than the estimated focus threshold, it is represented thatthe previous estimated focus value is the local pole, then the currentdirection of movement of the lens is the direction of movement in thenext movement.

Further, in one embodiment of the disclosure, the estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm. It will not be difficult to understandthat in the present embodiment, a scenario recognition algorithm ispreset, and different scenarios and estimated focus thresholds arestored in association. Specifically, in the present embodiment, lightintensity information of the image data, as well as a change law and adistribution condition of the obtained estimated focus values can beanalyzed according to the acquired image data to judge a currentscenario of the object.

Further, when determining the direction of movement of the lens in thenext movement, it is also necessary to synchronously determine a speedof movement of the lens in the next movement. Specifically, referring toFIG. 2, in one embodiment of the method according to the disclosure, thefollowing step is further comprised:

S13: a speed determination step of comparing the rate of change with apreset focus change threshold, and determining a speed of movement ofthe lens in the next movement on the basis of a comparison result.

Specifically, in one embodiment of the disclosure, when the rate ofchange obtained in aforesaid step is less than the focus changethreshold, it is represented that the current focus position is stilllocated in a gentler area in the S2 curve as depicted in FIG. 1, thatis, the current focus position is still at a certain distance from thetarget focus position, then movement can be continued at a first speedat which the lens currently moves; otherwise, when the rate of change isnot less than the preset focus change threshold, it is represented thatthe current focus position is located in an area where the change of theslope is large in the S2 curve as depicted in FIG. 1, that is, thecurrent focus position is near the target focus position, then a presetsecond speed value is used as the speed of movement of the lens in thenext movement, wherein the second speed value is less than the firstspeed value. Of course, it will not be difficult to understand that,when the rate of change is not less than the preset focus changethreshold, it is also possibly represented that the current focusposition is located on a pseudo peak of the S2 curve, i.e., near a localpole where noise is located. Hereinafter, how to judge whether the focusposition is near the local pole will be described in detail.

Specifically, in one embodiment of the disclosure, an estimated focusthreshold is preset; when it is obtained that the rate of change is notless than the preset focus change threshold, a current estimated focusvalue is acquired, and it is judged whether the current estimated focusvalue is greater than the preset focus change threshold; if YES, it isrepresented that the estimated focus value is not the local pole, then apreset second speed value is used as the speed of movement of the lensin the next movement; otherwise, when the current estimated focus valueis not greater than the preset estimated focus threshold, it isrepresented that the focus position where the change of the rate occursis impossibly near the target focus position, but very possibly near thelocal pole, then a preset third value is used as the speed of movementof the lens in the next movement, wherein the third speed value isgreater than the second speed value and is less than the first speedvalue. Of course, the lens may also be continued to be moved at thefaster first speed herein, but a third speed value is set to avoid acase where the target focus position is overridden due to the quite fastfirst speed in some application scenarios, thus improving the precisionand reliability of the system. It should be noticed that all theestimated focus threshold, the second speed value and the third speedvalue are stored in advance in a storage medium, wherein the storagemedium may be a Synchronous Dynamic Random Access Memory (SDRAM),Multi-Chip-Package (MCP) memory or a Dynamic Random Access Memory(DRAM).

Further, in one embodiment of the disclosure, the estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm. It will not be difficult to understandthat in the present embodiment, a scenario recognition algorithm ispreset, and different scenarios and estimated focus thresholds arestored in association. Specifically, in the present embodiment, lightintensity information of the image data, as well as a change law and adistribution condition of the obtained estimated focus values can beanalyzed according to the acquired image data to judge a currentscenario of the object.

Further, the disclosure further comprises the following step:

S14: repeatedly performing said focus value calculation step, saiddirection determination step and said speed determination step until thelens moves to a focus position corresponding to a maximum of theestimated focus values.

It will not be difficult to understand that, said focus valuecalculation step, said direction determination step and said speeddetermination step are performed synchronously, until the lens moves toa focus position corresponding to a maximum of the estimated focusvalues. Specifically, in the step, driving means is invoked to move thelens to the target focus position. It should be noticed that the drivingmeans may be a stepping motor, which is driven to rotate under thecontrol of a controller or a driver, so as to drive movement of thelens.

The disclosure provides a method for camera rapid automatic focusing,which: acquires image data of an object at multiple different focuspositions between a lens and the object; and calculates an estimatedfocus value in a first high frequency and a determined focus value in asecond high frequency for each image data; and calculates a rate ofchange between a current determined focus value and a previousdetermined focus value, and determines a direction of movement of thelens in a next movement on the basis of a comparison result of the rateof change with a preset focus change threshold, until the lens moves toa focus position corresponding to a maximum of the estimated focusvalue. That is, the disclosure can change a speed of movement of thelens on the basis of a value of the rate of change, that is, employdifferent speeds of movement at different positions, thus effectivelyreducing focusing time, while taking into consideration focusing speedand precision, and providing high reliability and practicability.

The above focusing method according to the disclosure, in the process ofdetermining a direction of movement of a lens, when a rate of change ofan acquired determined focus value is negative, compares a currentestimated focus value with a preset estimated focus threshold; when theestimated focus value is less than the preset estimated focus threshold,it is represented that the estimated focus value is possibly near alocal pole, then a current direction of movement is determined as theabove direction of movement; otherwise, a direction of movement of thelens is changed. It is made possible to identify the local pole, thusavoiding a problem of shaking due to being trapped at the local poleduring focusing.

Based on modularization thinking of a computer, the disclosure furtherprovides a device for camera rapid automatic focusing. Referring to FIG.3, the device comprises a focus value calculation module 11, a directiondetermination module 12, a speed determination module 13 and a movementmodule 14. It should be noticed that the device according to thedisclosure is applied to a camera or a video camera with an automaticfocus function. Of course, the device according to the disclosure mayalso be applied to devices with a photographing function, such as acellphone, a PAD, a Portable Multimedia Player (PMP), a TV or the like.To facilitate descriptions, the embodiments of the disclosureillustratively describe its detailed implementation by taking a digitalvideo camera as an example; however, this embodiment cannot constitutelimitations to the disclosure. Below, specific functions implemented bythe respective modules will be described in detail.

The focus value calculation module 11 is used for driving a lens to moveto multiple different focus positions to acquire respective image dataof a certain object, and calculating a corresponding estimated focusvalue in a first high frequency and a corresponding determined focusvalue in a second high frequency for each image data, wherein afrequency value in the second high frequency is greater than a frequencyvalue in the first high frequency.

It should be noticed that the focus value calculation module 11according to the disclosure drives a lens to move between the lens andan object through driving means, and presets a first speed value atwhich the lens moves, and stops the lens based on a preset timeinterval, so as to acquire corresponding image data at a current focusposition; that is, the focus value calculation module 11 can acquireimage data at multiple different focus positions, and calculate acorresponding estimated focus value in a first high frequency for theimage data and calculate a corresponding determined focus value in asecond high frequency for the image data

It should be noticed that the driving means may be a stepping motor,which is driven to rotate under the control of a controller or a driver,so as to drive movement of the lens. It will not be difficult tounderstand that the preset time interval and the first speed value atwhich the lens initially moves which are preset in the focus valuecalculation module 11 may be stored in advance in a storage medium,wherein the storage medium may be a Synchronous Dynamic Random AccessMemory (SDRAM), Multi-Chip-Package (MCP) memory or a Dynamic RandomAccess Memory (DRAM).

It should be noticed that the first speed value at which the lens movesin the focus value calculation module 11 may also be understood as aninitial unit step length, and the step length refers to a distance ofmovement of the lens during a period from a current focus positioncorresponding to the start of movement to the stop of the movement. Inan actual operation process, the unit step length is generallyrepresented by a pulse number of a specific pulse width, so its specificnumerical value is related to relevant parameters of the usedcontroller, driver and motor, and meanwhile the numerical value of thestep length also determines the real-time and robustness of an algorithmto a certain extent, and thus shall be determined through experimentsaccording to actual system constitution. The step length generallyproduces the following influences upon the entire method: if the steplength is too small, time consumption of the automatic focus processwill be serious, and meanwhile it will be made easy to be trapped at thelocal pole in a focus start phase; however, if the step length is toolarge, it will be made easy to override a maximum of the estimated focusvalues in a search process of the maximum, and if the overriddendistance is too great, the algorithm adopted in the device will bedisabled to converge.

It will not be difficult to understand that: if it is assumed that themultiple focus positions where the lens is driven to move include atarget focus position, then multiple groups of estimated focus valuesand corresponding focus positions thereof may form the focus curve S1diagram as shown in FIG. 1, and for the same reason, multiple groups ofdetermined focus values and corresponding focus positions thereof mayform the focus curve S2 diagram as shown in FIG. 1. The same focusposition corresponds to one estimated focus value and one determinedfocus value, and both the maximum of the estimated focus values and themaximum of the determined focus values correspond to the same targetfocus position.

Specifically, the focus value calculation module 11 according to thepresent embodiment, by invoking driving means, changes a distancebetween the lens and the object based on a certain time interval andacquires image data of a certain frame of the image at focus positionscorresponding to the distance. Then, the focus value calculation module11 performs de-noising, gamma correction, color filter arrayinterpolation, color matrix processing, color correction or colorenhancement on the image data through an image signal processing deviceto improve image quality, and by performing filtering and de-noising bytwo high-pass filters or band-pass filters in different frequency bands,high-frequency component data of the image data in the two differentfrequency bands can be obtained. Then based on the acquired data and apreset first calculation rule, the focus value calculation module 11 cancalculate a corresponding estimated focus value in the first highfrequency f1 and a corresponding determined focus value in the secondfrequency f2, where f2>f1.

Thus it will not be difficult to understand that, in FIG. 1, since morenoise can be filtered in the second high frequency f2, the focus curvecorresponding to the second high frequency f2 at a position farther fromthe target focus position is gentler than the focus curve correspondingto the first high frequency f1 at the same focus position; however, acurve change rate of the focus curve corresponding to the second highfrequency f2 at a position closer to the target focus position isgreater than a slope of the focus curve corresponding to the first highfrequency f1 at the same focus position. That is, by judging a slopevalue of curve change in the second high frequency f2, it can beobtained more accurately that the current focus position of the lens isreaching the target focus position. Hereinafter, it will be described indetail how to use curve features in the second high frequency f2 toprompt that the lens is reaching the target focus position, so as tochange a speed of movement of the lens.

Specifically, as shown by one embodiment of the disclosure, afteracquiring the image data at the multiple focus positions, the focusvalue calculation module 11 further calculates corresponding estimatedfocus value and determined focus value for each of the multiple focuspositions based on a preset first calculation rule, wherein the presetfirst calculation rule is preset to be stored in a storage medium,wherein the storage medium may be a Synchronous Dynamic Random AccessMemory (SDRAM), Multi-Chip-Package (MCP) memory or a Dynamic RandomAccess Memory (DRAM).

It should be noticed that the estimated focus value and the determinedfocus value described in the disclosure refer to numerical valueestimation indices representing states of a characterizing portion and aprofile portion of a clearly visible image. Thus for the estimated focusvalue, the estimated focus value can be calculated through edgeenhancement of differences in brightness data between adjacent pixels ofthe image, or, the estimated focus value can also be calculatedaccording to a gray value of a pixel, a reciprocal of brightness, adeviation of brightness and the like.

As shown by one embodiment of the disclosure, a corresponding algorithmfor calculating corresponding estimated focus value and determined focusvalue for each of the multiple focus positions by the focus valuecalculation module 11 in the disclosure is:Estimated focus value=Σ_(x=0) ^(n)Σ_(y=0) ^(n) |hpf_o(x,y)|²,

where the x denotes a horizontal high-frequency component value, and they denotes a vertical high-frequency component value. This algorithmobtains the estimated focus value by performing an accumulation on allhorizontal x and vertical y high-frequency energy values of the obtainedcurrent frame of image data of the data image.

Further, referring to FIG. 3, the direction determination module 12 inthe disclosure is used for calculating a rate of change between acurrent determined focus value and a previous determined focus value,and determining a direction of movement of the lens in a next movementon the basis of the rate of change being either positive or negative.

It will not be difficult to understand from aforesaid focus valuecalculation module 11 that, when the focus curve corresponding to thesecond frequency f2 moves from a gentle position to the vicinity of thetarget focus position, the change of the slope of the curve is greater;that is, it can be judged, from the rate of change of the curve, whetheran area where the current focus position lies is close to the targetfocus position. In one embodiment of the disclosure, the algorithm forcalculating the rate of change between the acquired current determinedfocus value and the previous determined focus value by the directiondetermination module 12 is:Change rate=(Current determined focus value−Previous determined focusvalue)÷Step length,

wherein the step length is a step length for the lens to move from afocus position corresponding to the previous determined focus value to afocus position corresponding to the current determined focus value.

Further, in one embodiment of the disclosure, the directiondetermination module 12 determines the direction of movement of the lensin the next movement on the basis of the rate of change being eitherpositive or negative. When the rate of change between the acquiredcurrent determined focus value and the previous determined focus valuewhich is calculated by the direction determination module 12 ispositive, it is represented that the current determined focus value isgreater than the previous determined focus value, that is, the currentfocus position does not override a peak value of the target focusposition, then it can be determined that a current direction of movementof the lens is the direction of movement of the lens in the nextmovement; and otherwise, when the rate of change which is calculated bythe direction determination module 12 is negative, it is representedthat the current determined focus value is smaller than the previousdetermined focus value, that is, the current focus position possibly hasoverridden the peak value of the target focus position or has overriddenone local pole. Thus in the present embodiment, the directiondetermination module 12 also necessarily further judges whether thecurrent focus position is only the local pole which has been overridden.

Specifically, in one embodiment of the disclosure, an estimated focusthreshold is preset in the direction determination module 12; when it isalready judged by the direction determination module 12 that theacquired rate of change is negative, it is also necessary to compare thecurrent estimated focus value with the preset estimated focus threshold;when the estimated focus threshold is greater than or equal to theestimated focus value, it is represented that the estimated focus valueis not the local pole, which indicates that the target focus positionhas been overridden, then the direction of movement of the lens in thenext movement is opposite to the current direction of movement; andotherwise, when it is obtained by the direction determination module 12that the current estimated focus value is less than the estimated focusthreshold, it is represented that the previous estimated focus value isthe local pole, then the current direction of movement of the lens isthe direction of movement in the next movement.

Further, in one embodiment of the disclosure, the estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm. It will not be difficult to understandthat in the present embodiment, a scenario recognition algorithm ispreset, and different scenarios and estimated focus thresholds arestored in association. Specifically, in the present embodiment, lightintensity information of the image data, as well as a change law and adistribution condition of the obtained estimated focus values can beanalyzed according to the acquired image data to judge a currentscenario of the object.

Further, when the direction determination module 12 determines thedirection of movement of the lens in the next movement, it is alsonecessary to synchronously determine a speed of movement of the lens inthe next movement. Specifically, referring to FIG. 3, the speeddetermination module 13 in the disclosure is used for comparing the rateof change with a preset focus change threshold, and determining a speedof movement of the lens in the next movement on the basis of acomparison result.

Specifically, in one embodiment of the disclosure, when the rate ofchange obtained in the speed determination module 13 is less than thefocus change threshold, it is represented that the current focusposition is still located in a gentler area in the S2 curve as depictedin FIG. 1, that is, the current focus position is still at a certaindistance from the target focus position, then movement can be continuedat a first speed at which the lens currently moves; otherwise, when therate of change obtained in the speed determination module 13 is not lessthan the preset focus change threshold, it is represented that thecurrent focus position is located in an area where the change of theslope is large in the S2 curve as depicted in FIG. 1, that is, thecurrent focus position is near the target focus position, then a presetsecond speed value is used as the speed of movement of the lens in thenext movement, wherein the second speed value is less than the firstspeed value. Of course, it will not be difficult to understand that,when the rate of change is not less than the preset focus changethreshold, it is also possibly represented that the current focusposition is located on a pseudo peak of the S2 curve, i.e., near a localpole where noise is located. Hereinafter, how the speed determinationmodule 13 judges whether the focus position is near the local pole willbe described in detail.

Specifically, in one embodiment of the disclosure, an estimated focusthreshold is preset in the speed determination module 13; when it isobtained that the rate of change is not less than the preset focuschange threshold, the speed determination module 13 acquires a currentestimated focus value, and judges whether the current estimated focusvalue is greater than the preset focus change threshold; if YES, it isrepresented that the estimated focus value is not the local pole, thenthe speed determination module 13 uses a preset second speed value asthe speed of movement of the lens in the next movement; otherwise, whenit is obtained in the speed determination module 13 that the currentestimated focus value is not greater than the preset estimated focusthreshold, it is represented that the focus position where the change ofthe rate occurs is impossibly near the target focus position, but verypossibly near the local pole, then the speed determination module 13uses a preset third value as the speed of movement of the lens in thenext movement, wherein the third speed value is greater than the secondspeed value and is less than the first speed value. Of course, the speeddetermination module 13 may also continue to move the lens at the fasterfirst speed herein, but a third speed value is set to avoid a case wherethe target focus position is overridden due to the quite fast firstspeed in some application scenarios, thus improving the precision andreliability of the system. It should be noticed that all the estimatedfocus threshold, the second speed value and the third speed value arestored in advance in a storage medium, wherein the storage medium may bea Synchronous Dynamic Random Access Memory (SDRAM), Multi-Chip-Package(MCP) memory or a Dynamic Random Access Memory (DRAM).

Further, in one embodiment of the disclosure, the estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm. It will not be difficult to understandthat in the speed determination module 13 in the present embodiment, ascenario recognition algorithm is preset, and different scenarios andestimated focus thresholds are stored in association. Specifically, thespeed determination module 13 in the present embodiment can analyzelight intensity information of the image data, as well as a change lawand a distribution condition of the obtained estimated focus valuesaccording to the acquired image data to judge a current scenario of theobject.

Further, referring to FIG. 3, the movement module 14 according to thedisclosure is used for repeatedly invoking the focus value calculationmodule, the direction determination module and the speed determinationmodule to perform corresponding operations, until the lens moves to afocus position corresponding to a maximum of the estimated focus values.

It will not be difficult to understand that the movement module 14repeatedly invokes said focus value calculation module 11, saiddirection determination module 12 and said speed determination module 13to perform corresponding operations, until the lens moves to a focusposition corresponding to a maximum of the estimated focus values.Specifically, the movement module 14 invokes driving means to move thelens to the target focus position. It should be noticed that the drivingmeans may be a stepping motor, which is driven to rotate under thecontrol of a controller or a driver, so as to drive movement of thelens.

The disclosure provides a device for camera rapid automatic focusing,which acquires image data of an object at multiple different focuspositions between a lens and the object through a focus valuecalculation module 11, and calculates an estimated focus value in afirst high frequency and a determined focus value in a second highfrequency for each image data; then a direction determination module 12calculates a rate of change between a current determined focus value anda previous determined focus value; a speed determination module 13determines a direction of movement of the lens in a next movement on thebasis of a comparison result of the rate of change with a preset focuschange threshold, until the lens moves to a focus position correspondingto a maximum of the estimated focus value. That is, the disclosure canchange a speed of movement of the lens on the basis of a value of therate of change through the speed determination module 13, that is,employ different speeds of movement at different positions, thuseffectively reducing focusing time, while taking into considerationfocusing speed and precision, and providing high reliability andpracticability.

The above focusing device according to the disclosure, in the process ofdetermining a direction of movement of a lens, when a rate of change ofa determined focus value which is calculated by the directiondetermination module 12 is negative, the speed determination module 13compares a current estimated focus value with a preset estimated focusthreshold; when the estimated focus value is less than the presetestimated focus threshold, it is represented that the estimated focusvalue is possibly near a local pole, then a current direction ofmovement is determined as the above direction of movement; otherwise, adirection of movement of the lens is changed. It is made possible toidentify the local pole, thus avoiding a problem of shaking due to beingtrapped at the local pole during focusing.

The description provided here explains plenty of details. However, itcan be understood that the embodiments of the disclosure can beimplemented without these specific details. The known methods, structureand technology are not shown in detail in some embodiments, so as not toobscure the understanding of the description.

Although some illustrative embodiments of the invention are illustratedabove, those skilled in the art will understand that, the illustrativeembodiments can be modified without departing from the spirit andprinciple of the embodiments of the invention. The scopes of theembodiments of the invention are limited by the claims and equivalentsthereof.

As for the device embodiments, because they are similar basically to themethod embodiments, the description thereof is simple relatively andsimilar content can be referred to the description of the methodembodiments.

The algorithm and display provided here have no inherent relation withany specific computer, virtual system or other devices. Variousgeneral-purpose systems can be used together with the teaching based onthis. According to the description above, the structure required toconstruct this kind of system is obvious. Besides, the disclosure is notdirected at any specific programming language. It should be understoodthat various programming language can be used for achieving the contentof the disclosure described here, and above description of specificlanguage is for disclosing the optimum embodiment of the disclosure.

The description provided here explains plenty of details. However, itcan be understood that the embodiments of the disclosure can beimplemented without these specific details. The known methods, structureand technology are not shown in detail in some embodiments, so as not toobscure the understanding of the description.

Similarly, it should be understood that in order to simplify thedisclosure and help to understand one or more of the various aspects ofthe disclosure, in the above description of the illustrative embodimentsof the disclosure, the various features of the disclosure are sometimesgrouped into a single embodiment, drawing, or description thereof.However, the method disclosed should not be explained as reflecting thefollowing intention: that is, the disclosure sought for protectionclaims more features than the features clearly recorded in every claim.To be more precise, as is reflected in the following claims, the aspectsof the disclosure are less than all the features of a single embodimentdisclosed before. Therefore, the claims complying with a specificembodiment are explicitly incorporated into the specific embodimentthereby, wherein every claim itself as an independent embodiment of thedisclosure.

Those skilled in the art can understand that adaptive changes can bemade to the modules of the devices in the embodiment and the modules canbe installed in one or more devices different from the embodiment. Themodules or units or elements in the embodiment can be combined into onemodule or unit or element, and furthermore, they can be separated intomore sub-modules or sub-units or sub-elements. Except such featuresand/or process or that at least some in the unit are mutually exclusive,any combinations can be adopted to combine all the features disclosed bythe description (including the attached claims, abstract and figures)and any method or all process of the device or unit disclosed as such.Unless there is otherwise explicit statement, every feature disclosed bythe present description (including the attached claims, abstract andfigures) can be replaced by substitute feature providing the same,equivalent or similar purpose.

In addition, a person skilled in the art can understand that althoughsome embodiments described here comprise some features instead of otherfeatures included in other embodiments, the combination of features ofdifferent embodiments means falling into the scope of the disclosure andforming different embodiments. For example, in the following claims, anyone of the embodiments sought for protection can be used in variouscombination modes.

The various components embodiments of the disclosure can be realized byhardware, or realized by software modules running on one or moreprocessors, or realized by combination thereof. A person skilled in theart should understand that microprocessor or digital signal processor(DSP) can be used for realizing some or all functions of some or allcomponents of the asynchronous login device according to the embodimentsin the disclosure in practice. The disclosure can also realize one partof or all devices or system programs (for example, computer programs andcomputer program products) used for carrying out the method describedhere. Such programs for realizing the disclosure can be stored incomputer readable medium, or can possess one or more forms of signal.Such signals can be downloaded from the Internet website or be providedat signal carriers, or be provided in any other forms.

For example, FIG. 4 shows a terminal device for the method for camerarapid automatic focusing according to the disclosure. The terminaldevice traditionally comprises a processor 410 and a computer programproduct in the form of storage 420 or a computer readable medium. Thestorage 420 can be electronic storage such as flash memory, EEPROM(Electrically Erasable Programmable Read-Only Memory), EPROM, hard diskor ROM, and the like. The storage 420 possesses storage space 430 forcarrying out program code 631 of any steps of aforesaid method. Forexample, storage space 430 for program code can comprise various programcodes 431 used for realizing any steps of aforesaid method. Theseprogram codes can be read out from one or more computer program productsor write in one or more computer program products. The computer programproducts comprise program code carriers such as hard disk, Compact Disc(CD), memory card or floppy disk and the like. These computer programproducts usually are portable or fixed storage cell as said in FIG. 5.The storage cell can possess memory paragraph, storage space like thestorage 420 in the terminal device in FIG. 4. The program code can becompressed in, for example, a proper form. Generally, storage cellcomprises computer readable code 431′, i.e. the code can be read byprocessors such as 410 and the like. When the codes run on a computerdevice, the computer device will carry out various steps of the methoddescribed above.

It should be noticed that the embodiments are intended to illustrate thedisclosure and not limit this disclosure, and a person skilled in theart can design substitute embodiments without departing from the scopeof the appended claims. In the claims, any reference marks betweenbrackets should not be constructed as limit for the claims. The word“comprise” does not exclude elements or steps that are not listed in theclaims. The word “a” or “one” before the elements does not exclude thatmore such elements exist. The disclosure can be realized by means ofhardware comprising several different elements and by means of properlyprogrammed computer. In the unit claims several devices are listed,several of the systems can be embodied by a same hardware item. The useof words first, second and third does not mean any sequence. These wordscan be explained as name.

In addition, it should be noticed that the language used in thedisclosure is chosen for the purpose of readability and teaching,instead of for explaining or limiting the topic of the disclosure.Therefore, it is obvious for a person skilled in the art to make a lotof modification and alteration without departing from the scope andspirit of the appended claims. For the scope of the disclosure, thedisclosure is illustrative instead of restrictive. The scope of thedisclosure is defined by the appended claims.

What is claimed is:
 1. A method for camera rapid automatic focusing,comprising: a focus value calculation step of driving a lens to move tomultiple different focus positions to acquire respective image data of acertain object, and calculating a corresponding estimated focus value ina first high frequency and a corresponding determined focus value in asecond high frequency for each image data, wherein a frequency value inthe second high frequency is greater than a frequency value in the firsthigh frequency; a direction determination step of calculating a rate ofchange between a current determined focus value and a previousdetermined focus value, and determining a direction of movement of thelens in a next movement on the basis of the rate of change being eitherpositive or negative; a speed determination step of comparing the rateof change with a preset focus change threshold, and determining a speedof movement of the lens in the next movement on the basis of acomparison result; and repeatedly performing said focus valuecalculation step, said direction determination step and said speeddetermination step until the lens moves to a focus positioncorresponding to a maximum of the estimated focus values.
 2. The methodaccording to claim 1, wherein the speed determination step furthercomprises: in a case that the rate of change is less than the presetfocus change threshold, continuing to use a current preset first speedvalue as the speed of movement of the lens in the next movement; andotherwise, in a case that the rate of change is not less than the presetfocus change threshold, using a preset second speed value as the speedof movement of the lens in the next movement; wherein the second speedvalue is less than the first speed value.
 3. The method according toclaim 2, wherein the step of, in a case that the rate of change is notless than the preset focus change threshold, using a preset second speedvalue as the speed of movement of the lens in the next movement furthercomprises: in a case that the rate of change is not less than the presetfocus change threshold, acquiring a current estimated focus value;judging whether the current estimated focus value is greater than apreset estimated focus threshold; if YES, using a preset second speedvalue as the speed of movement of the lens in the next movement;otherwise, using a preset third speed value as the speed of movement ofthe lens in the next movement, wherein the third speed value is greaterthan the second speed value and is less than the first speed value. 4.The method according to claim 3, wherein the preset estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm.
 5. The method according to claim 1,wherein an algorithm for calculating the rate of change between thecurrent determined focus value and the previous determined focus valueis:Change rate=(Current determined focus value−Previous determined focusvalue)÷Step length, wherein the step length is a step length for thelens to move from a focus position corresponding to the previousdetermined focus value to a focus position corresponding to the currentdetermined focus value.
 6. The method according to claim 1, wherein thedirection determination step further comprises: in a case that thecalculated rate of change between the current determined focus value andthe previous determined focus value is positive, determining that acurrent direction of movement of the lens is the direction of movementof the lens in the next movement; and otherwise, in a case that the rateof change is negative, determining that a direction opposite to thecurrent direction of movement of the lens is the direction of movementof the lens in the next movement.
 7. The method according to claim 6,wherein the step of, in a case that the rate of change is negative,determining that a direction opposite to the current direction ofmovement of the lens is the direction of movement of the lens in thenext movement further comprises the steps of: in a case that the rate ofchange is negative, acquiring a current estimated focus value; judgingwhether the current estimated focus value is greater than a presetestimated focus threshold; and if YES, determining that that a directionopposite to the current direction of movement of the lens is thedirection of movement of the lens in the next movement; otherwise,determining that the current direction of movement of the lens is thedirection of movement of the lens in the next movement.
 8. The methodaccording to claim 1, wherein the focus value calculation step furthercomprises: driving the lens to move to the multiple different focuspositions at a preset first speed value to acquire the respective imagedata of the certain object; and on the basis of the acquired respectiveimage data and a preset first calculation rule, calculatingcorresponding estimated focus value and determined focus value for eachof the multiple focus positions.
 9. The method according to claim 1,wherein the step of driving a lens to move to multiple different focuspositions to acquire respective image data of a certain objectcomprises: invoking driving a means to move the lens to change adistance between the lens and the object, and acquiring the respectiveimage data at focus positions corresponding to the distance.
 10. Themethod according to claim 9, wherein the step of invoking driving meansto change a distance between the lens and the object further comprises:invoking the driving means to change a distance between the lens and theobject based on a certain time interval.
 11. A device for camera rapidautomatic focusing, comprising: one or more processors; and a memory;wherein one or more programs are stored in the memory, and when executedby the one or more processors, the one or more programs cause the one ormore processors to: drive a lens to move to multiple different focuspositions to acquire respective image data of a certain object, andcalculate a corresponding estimated focus value in a first highfrequency and a corresponding determined focus value in a second highfrequency for each image data, wherein a frequency value in the secondhigh frequency is greater than a frequency value in the first highfrequency; calculate a rate of change between a current determined focusvalue and a previous determined focus value, and determine a directionof movement of the lens in a next movement on the basis of the rate ofchange being either positive or negative; compare the rate of changewith a preset focus change threshold, and determine a speed of movementof the lens in the next movement on the basis of a comparison result;and repeatedly perform said focus value calculation, said directiondetermination and said speed determination until the lens moves to afocus position corresponding to a maximum of the estimated focus values.12. The device according to claim 11, wherein the one or more processorsare further caused to: in a case that the rate of change is less thanthe preset focus change threshold, continue to use a current presetfirst speed value as the speed of movement of the lens in the nextmovement; and otherwise, in a case that the rate of change is not lessthan the preset focus change threshold, use a preset second speed valueas the speed of movement of the lens in the next movement; wherein thesecond speed value is less than the first speed value.
 13. The deviceaccording to claim 12, wherein the one or more processors are furthercaused to: in a case that the rate of change is not less than the presetfocus change threshold, acquire a current estimated focus value; judgewhether the current estimated focus value is greater than a presetestimated focus threshold; and if YES, use a preset second speed valueas the speed of movement of the lens in the next movement; otherwise,use a preset third speed value as the speed of movement of the lens inthe next movement, wherein the third speed value is greater than thesecond speed value and is less than the first speed value.
 14. Thedevice according to claim 13, wherein the preset estimated focusthreshold corresponds to a scenario corresponding to an object in thelens; wherein the scenario is obtained through recognition by a presetscenario recognition algorithm.
 15. The device according to claim 11,wherein an algorithm for calculating the rate of change between thecurrent determined focus value and the previous determined focus valueis:Change rate=(Current determined focus value−Previous determined focusvalue)÷Step length, wherein the step length is a step length for thelens to move from a focus position corresponding to the previousdetermined focus value to a focus position corresponding to the currentdetermined focus value.
 16. The device according to claim 11, whereinthe one or more processors are further caused to: in a case that thecalculated rate of change between the current determined focus value andthe previous determined focus value is positive, determine that acurrent direction of movement of the lens is the direction of movementof the lens in the next movement; and otherwise, in a case that the rateof change is negative, determine that a direction opposite to thecurrent direction of movement of the lens is the direction of movementof the lens in the next movement.
 17. The device according to claim 16,wherein the one or more processors are further caused to: in a case thatthe rate of change is negative, acquire a current estimated focus value;judge whether the current estimated focus value is greater than a presetestimated focus threshold; and if YES, determine that that a directionopposite to the current direction of movement of the lens is thedirection of movement of the lens in the next movement; otherwise,determine that the current direction of movement of the lens is thedirection of movement of the lens in the next movement.
 18. The deviceaccording to claim 11, wherein the one or more processors are furthercaused to: drive the lens to move to the multiple different focuspositions at a preset first speed value to acquire the image data of thecertain object; and on the basis of the acquired image data and a presetfirst calculation rule, calculate corresponding estimated focus valueand determined focus value for each of the multiple focus positions. 19.The device according to claim 11, wherein the one or more processors arefurther caused to invoke a driving means to move the lens to change adistance between the lens and the object, and acquire the image data atfocus positions corresponding to the distance.
 20. The device accordingto claim 19, wherein the one or more processors are further caused toinvoke the driving means to change a distance between the lens and theobject based on a certain time interval.